<?php

require_once('../vendor/autoload.php');

use PayPal\Rest\ApiContext;
use PayPal\Auth\OAuthTokenCredential;

// 下面为申请appget的clientId和clientSecret，必填项，否则无法生成token。
$clientId = 'AZmm7Fp8YvBWNnVLg39Nyh7ruUOnKF8iTw4RxCWgURMDZDd03quFKLMB9PDVnquSyRJ-uplTrW1yJjxb';
$clientSecret = 'EJpC0g4vL6kSe3Vubv-Q2TK546rYAJ5NuTYigqoAOuND0X75gsH_oFE0a3MRv-mWsxfaXkWQCQ6HxXv5';
$apiContext = new ApiContext(
    new OAuthTokenCredential(
        $clientId,
        $clientSecret
    )
);
$apiContext->setConfig(
    array(
        'mode' => 'sandbox',
        'log.LogEnabled' => true,
        'log.FileName' => '../PayPal.log',
        'log.LogLevel' => 'DEBUG',
        'cache.enabled' => true
    )
);